/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved.
 */
#ifndef VPC_PIPE_COMM_H
#define VPC_PIPE_COMM_H

#include "dvpp_cmdlist_define.h"
#include "dvpp_cmdlist_num_define.h"
#include "vpc_pipeline/vpc_pipe_types.h"
#include "vpc_pipeline/pipeline_top.h"
#include "vpc_pipeline/dvpp_vpc_pipe.h"

/**********************comm proc**********************/
void vpc_pipe_set_src_pic_info(vpc_pipe_ctx_t *ctx, const vpc_pipe_pic_info_t *src);
void vpc_pipe_set_src_hfbc_info(vpc_pipe_ctx_t *ctx, vpc_hfbc_info_t *src);
void vpc_pipe_set_dst_pic_info(vpc_pipe_ctx_t *ctx, const vpc_pipe_pic_info_t *dst[PIPE_OUT_NUM], uint32_t num);
void vpc_pipe_set_apart_src_pic_info(vpc_pipe_ctx_t *ctx, vpc_apart_pic_info_t *apart_src);
void vpc_pipe_set_apart_dst_pic_info(vpc_pipe_ctx_t *ctx, vpc_apart_pic_info_t *apart_dst[PIPE_OUT_NUM], uint32_t num);
/**********************comm proc**********************/

/**********************channel**********************/
uint64_t get_cvdr_base_addr(const vpc_pipe_pic_info_t *pic, const vpc_fmt_info_t *fmt_info,
    uint32_t wstride[COLOR_CHNANNEL_NUM], uint32_t top, uint32_t left, uint32_t port);
void vpc_pipe_set_in0_cvdr_channel(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_out_cvdr_channel(const vpc_pipe_ctx_t *ctx, uint32_t chn);
void vpc_pipe_set_rdma_channel(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_in0_cvdr_channel_by_apart_info(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_out_cvdr_channel_by_apart_info(const vpc_pipe_ctx_t *ctx, uint32_t chn);
void vpc_pipe_set_paste(const vpc_pipe_ctx_t *ctx, uint32_t top_off, uint32_t left_off, uint32_t width, uint32_t chn);
void vpc_pipe_in0_cvdr_copy_1chn_to_3chn(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_cvdr_rd_nr(const vpc_pipe_ctx_t *ctx, uint8_t port, uint8_t du);
void vpc_pipe_set_output_cvdr_idle(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_input_cvdr_port_for_single_chn_by_pic(
    const vpc_pipe_ctx_t *ctx, const vpc_pipe_pic_info_t *pic, uint32_t port);

/**********************channel**********************/

/**********************kernel**********************/
// comm
void vpc_pipe_reset(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_default(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_ker_fmt(const vpc_pipe_ctx_t *ctx, const vpc_pic_fmt_e kernelFmt);
void vpc_pipe_set_channel_cache(const vpc_pipe_ctx_t *ctx, uint32_t run_mode);
void vpc_pipe_set_channel_out_type(const vpc_pipe_ctx_t *ctx, channel_out_type_e type);
void vpc_pipe_set_bitwidth(const vpc_pipe_ctx_t *ctx, bitwidth_e bitwidth);
void vpc_pipe_set_readtype(const vpc_pipe_ctx_t *ctx, read_type_e read_type);
void vpc_pipe_set_outpic_size(const vpc_pipe_ctx_t *ctx, uint32_t width, uint16_t height, uint32_t chn);
void vpc_pipe_set_int_merge(const vpc_pipe_ctx_t *ctx, uint32_t int_merge);
void vpc_pipe_set_errmask(const vpc_pipe_ctx_t *ctx, uint32_t errMask);
void vpc_pipe_set_top(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_top_in1(const vpc_pipe_ctx_t *ctx, const vpc_pipe_pic_info_t *layer1);
void vpc_pipe_set_in0swap(const vpc_pipe_ctx_t *ctx, uint8_t en);
void vpc_pipe_set_in0uvup(const vpc_pipe_ctx_t *ctx, uvup_method_e method);
void vpc_pipe_set_in0uvdown(const vpc_pipe_ctx_t *ctx, const uint32_t coeff[6]);
void vpc_pipe_set_outswap(const vpc_pipe_ctx_t *ctx, uint32_t chn, uint8_t en);
void vpc_pipe_direct_set_outswap(const vpc_pipe_ctx_t *ctx, uint32_t chn, uint32_t pos);
void vpc_pipe_set_outuvup(const vpc_pipe_ctx_t *ctx, uint32_t chn, uvup_method_e method);
void vpc_pipe_set_outuvdown(const vpc_pipe_ctx_t *ctx, uint32_t chn, uint8_t en);
void vpc_pipe_set_user_csc(vpc_pipe_ctx_t *ctx, const vpc_pipe_csc_info_t *info);
void vpc_pipe_set_in0_csc(const vpc_pipe_ctx_t *ctx);
void vpc_pipe_set_out_csc(const vpc_pipe_ctx_t *ctx, uint32_t chn);
void vpc_pipe_set_csc_alpha(const vpc_pipe_ctx_t *ctx, uint32_t alpha);
void vpc_pipe_set_crop_accelerate(vpc_pipe_ctx_t *ctx, const vpc_pipe_crop_para_t *para, uint8_t expend_edge);
void vpc_pipe_set_precrop(const vpc_pipe_ctx_t *ctx, const vpc_pipe_crop_para_t *para);
void vpc_pipe_set_resize(const vpc_pipe_ctx_t *ctx, const vpc_pipe_resize_para_t *para, uint32_t chn);
void vpc_pipe_set_resize_split(const vpc_pipe_ctx_t *ctx, const vpc_pipe_split_para_t *para, uint32_t chn);
void vpc_pipe_set_blend(
    const vpc_pipe_ctx_t *ctx, vpc_pipe_blending_type_e type, uint32_t offset, const vpc_pipe_pic_info_t *layer1,
    const vpc_pipe_blend_add_weight_config_t *add_weight_config);
void vpc_pipe_set_xflip(const vpc_pipe_ctx_t *ctx, uint8_t isPre, uint32_t inWidth, uint32_t inHeight);
void vpc_pipe_set_yflip(const vpc_pipe_ctx_t *ctx, uint8_t isPre);
void vpc_pipe_set_histogram(const vpc_pipe_ctx_t *ctx, uint32_t size, uint64_t addr, uint8_t is_yuvsum);
void vpc_pipe_set_affine(const vpc_pipe_ctx_t *ctx, affine_t *para, uint8_t en3d);
void vpc_pipe_set_filter(const vpc_pipe_ctx_t *ctx, filter_t *para);
void vpc_pipe_set_lut(const vpc_pipe_ctx_t *ctx, vpc_pipe_lut_remap_t *para, uint32_t in_width, uint32_t in_height);
/**********************kernel**********************/

void vpc_pipe_register_mlv1r1_export_func(void);
void vpc_pipe_register_mlv1r3_export_func(void);
void vpc_pipe_unregister_mlv1r1_export_func(void);
void vpc_pipe_unregister_mlv1r3_export_func(void);

#endif // #ifndef VPC_PIPE_COMM_H
